package com.jie.user.init;

import com.jie.common.util.ApiRestrictUtil;
import com.jie.common.util.LogUtil;
import com.jie.component.init.base.AbstractApplicationCommandLineRunnerHandler;
import com.jie.user.service.UserRegisterService;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.stereotype.Component;

@Component
public class ApiRestrictUtilInit extends AbstractApplicationCommandLineRunnerHandler {

    @Override
    public Integer executeOrder() {
        return 0;
    }

    @Override
    public void executeInit(ConfigurableApplicationContext context) {
        LogUtil.initLog("api限流工具");
        UserRegisterService bean = context.getBean(UserRegisterService.class);
        bean.setApiRestrictUtil(new ApiRestrictUtil(1000));
    }
}
